package com.atguigu.yygh.oss.controller;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.oss.service.OssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author mgx
 * @version 1.0
 * @description: TODO
 * @date 2022/9/3 0:32
 */
@RestController
@RequestMapping("/user/oss/file")
@Api(tags = {"oss服务管理"})
public class OssController {

    @Autowired
    private OssService ossService;

    @ApiOperation(value = "上传身份信息图片")
    @PostMapping("/upload")
    private R upload(MultipartFile file) {
        String imgUrl = ossService.upload(file);
        return R.ok().data("url", imgUrl);
    }
}
